function jump(nums){
    let len = nums.length
    const arr = new Array(len).fill(null)
    // 贪心算法
    arr[0] = 0
    for(let i=1; i<len; i++){
        for(let j=0; j<i; j++){
            if(nums[j] >= i-j){// 台阶i可达到
                arr[i] = arr[i]? Math.min(arr[i], arr[j] + 1) : arr[j] + 1
            }
           
        }
        
    }
    return arr[len - 1]
}

const nums = [2,3,1,1,4]
let minJumpNum = jump(nums)
console.log(minJumpNum)